﻿Imports lbGlobalcom
Public Class fCuadreCaja

    Private Sub fCuadreCaja_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            txtFechaCuadre.Text = Date.Today
            If CustomPrincipal.EsCajero Then
                txtCaja.Text = CustomPrincipal.IdCaja
                txtCaja.Enabled = False
            Else
                txtCaja.Enabled = True
                txtCaja.Text = ""
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub btnConsultar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConsultar.Click
        Try
            DsConsultaCartera.Clear()
            Dim Cuadre As cCuadreCaja = New cCuadreCaja(txtCaja.Text, CDate(txtFechaCuadre.Text), DsConsultaCartera)
            txtSaldoInicial.Text = Cuadre.SaldoInicial.ToString("c2")
            txtConsignaciones.Text = Cuadre.TotalConsignaciones.ToString("c2")
            txtGastos.Text = Cuadre.TotalGastos.ToString("c2")
            txtRecibosCaja.Text = Cuadre.TotalRecibosCaja.ToString("c2")
            txtSaldoCaja.Text = Cuadre.SaldoCaja.ToString("c2")
            txtVentasContado.Text = Cuadre.TotalVentasContado.ToString("c2")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub


    Private Sub btnImprimeCuadre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImprimeCuadre.Click
        Try
            PrintForm.Form = Me
            PrintForm.Print()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class